import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// import axios from 'axios'
// console.log(axios)
import Vant from 'vant';
import 'vant/lib/index.css';
import './assets/myVantStyle.css';
//将音频对象挂载在全局上
import audio from './util/audio.js';
Vue.prototype.audio = audio;
//挂载一个 vue 实例 在原型对线上, 方便后续项目中做非父子组件通讯
const bus = new Vue();
Vue.prototype.$bus = bus;

import { Lazyload } from 'vant';

Vue.use(Lazyload);

// 注册时可以配置额外的选项
Vue.use(Lazyload, {
  lazyComponent: true,
});

Vue.filter("formatSinger_global", function(val) {
	if (val) {
		val = val.map(el => {
			return el.name
		})
		return val.join(" / ");
	} else {
		return [];
	}

});
Vue.filter("formatduration_global", function(val) {
	val = Number(val);
	if (val / 60 < 1) {
		return '00:' + (val < 10 ? '0' + val : val);
	} else {
		let min = parseInt(val / 60);
		let sec = (val % 60);
		return "0" + min + ':' + (sec < 10 ? '0' + sec : sec);
	}
});
Vue.filter("formatPlaycount", function(value) {
	value = value / 10000;
	if (value >= 10000) {
		return (value / 10000).toFixed(1) + '亿';
	} else {
		return value.toFixed(1) + '万';
	}
})
Vue.filter("formatTimer", function(val) {
	var date = new Date(val);
	var year = date.getFullYear();
	var month = date.getMonth() + 1;
	var day = date.getDate();
	return `${year}` + '年' + `${month}` + '月' + `${day}` + '日';
})





Vue.use(Vant);
// import { Button } from 'vant';
// Vue.use(Button);
Vue.config.productionTip = false

// Vue.prototype.$axios = axios;

new Vue({
	router,
	store,
	render: h => h(App)
}).$mount('#app')
